<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<script type="text/javascript" charset="utf-8">
	$.messager.progress({
		text : '数据加载中....',
		interval : 100
	});
	String.prototype.trim = function () {
		return this .replace(/^\s\s*/, '' ).replace(/\s\s*$/, '' );
	};
	$(function(){
		$(".userType").live("change",function(){
			var type = $(".userType").val();
			$(".role").html("<input name='roid' style='width: 145px;' />");
			var roid = $('input[name=roid]');
			var roleIdsCombobox = roid.combobox({
				url : '${pageContext.request.contextPath}/qxgl/roleAction!noAuth_combobox.html?vRole.type='+type,
				valueField : 'id',
				textField : 'name',
				multiple : false,
				editable : false,
				panelHeight : 'auto',
				onLoadSuccess : function() {
					parent.$.messager.progress('close');
				}
			});
		});
	})
	
	function checkUser(th){
		var va = th.value;
		if(va.trim().length>0){
			$.ajax({
				url : '${pageContext.request.contextPath}/qxgl/userAction!datagrid_checkUser.html',
				data : {
							username : th.value
						},
				dataType : 'json',
				success : function(d){ 
					if(d.success==false){
						parent.sy.messagerShow({
							title : '提示',
							msg : d.msg
						});
					}
				}
			});
		}
	}
</script>
<div style="padding: 5px;">
	<form id="userForm" method="post">
		<table class="tableForm">
			<tr>
				<th style="width: 100px;">用户类型</th>
				<td>
					<select class="userType" name="userType" style="width: 145px;">
						<c:if test="${sessionInfo.type==0}">
							<option value="0">--请选择--</option>
							<option value="1">经销商(会员)</option>
							<option value="5">经销商(品牌)</option>
							<option value="2">代理商</option>
						</c:if>
						<c:if test="${sessionInfo.type==1||sessionInfo.type==2||sessionInfo.type==5}">
							<option value="0">--请选择--</option>
							<option value="3">店长</option>
							<option value="4">营业员</option>
						</c:if>
						<c:if test="${sessionInfo.type==3}">
							<option value="4">营业员</option>
						</c:if>
					</select>
				</td>
				<th style="width: 100px;">所属角色</th>
				<td class="role"><input name="roid" style="width: 145px;" /></td>
			</tr>
			<tr>
				<th style="width: 100px;">登&nbsp;录&nbsp;名</th>
				<td><input name="username" class="easyui-validatebox" onblur="checkUser(this)" data-options="required:'true',missingMessage:'请填写登录名称'" style="width: 145px;"/>
				</td>
				<th style="width: 100px;">真实姓名</th>
				<td><input name="realName" style="width: 145px;"/>
				</td>
			</tr>
			
			<tr>
				<th style="width: 100px;">起始时间</th>
				<td><input name="validDate" class="easyui-datebox" data-options="required:'true',editable:false" style="width: 145px;" />
				</td>
				<th style="width: 100px;">结束时间</th>
				<td><input name="expiryDate" class="easyui-datebox" data-options="required:'true',editable:false" style="width: 145px;" />
				</td>
			</tr>
			<c:if test="${sessionInfo.type==0}">
			<tr>
				<th style="width: 100px;">仓库个数</th>
				<td><input name="repertoryNum" class="easyui-numberbox"  style="width: 145px;" data-options="required:'true',missingMessage:'请填写仓库个数'"/>
				</td>
				<th style="width: 100px;">员工个数</th>
				<td><input name="lowerUserNum" class="easyui-numberbox"  style="width: 145px;" data-options="required:'true',missingMessage:'请填写员工个数'" />
				</td>
			</tr>
			</c:if>
			<tr>
				<th style="width: 100px;">用户状态</th>
				<td>
					<select name="status" style="width: 145px;">
						<option value="1">有效用户</option>
						<option value="2">无效用户</option>
					</select>
				</td>
				<th style="width: 100px;">性&nbsp;&nbsp;&nbsp;&nbsp;别</th>
				<td><input name="sex" style="width: 145px;" />
				</td>
			</tr>
			<c:if test="${sessionInfo.type!=3&&sessionInfo.type!=4&&sessionInfo.type!=0}">
			<tr>
				<th style="width: 100px;">所属仓库</th>
				<td><input name="reid" style="width: 145px;"  data-options="required:'true',missingMessage:'请选择仓库'" /></td>
				<th style="width: 100px;">职&nbsp;&nbsp;&nbsp;&nbsp;务</th>
				<td><input name="job" style="width: 145px;"/>
				</td>
			</tr>
			<tr>
				<th style="width: 100px;">雇佣性质</th>
				<td><input name="employType" style="width: 145px;"/>
				</td>
				<th style="width: 100px;">部&nbsp;&nbsp;&nbsp;&nbsp;门</th>
				<td><input name="dept" style="width: 145px;" />
				</td>
			</tr>
			</c:if>
			<tr>
				<th style="width: 100px;">手&nbsp;&nbsp;&nbsp;&nbsp;机</th>
				<td><input name="mobile" style="width: 145px;"/></td>
				<th style="width: 100px;">生&nbsp;&nbsp;&nbsp;&nbsp;日</th>
				<td><input name="birthday" class="easyui-datebox" style="width: 145px;" />
				</td>
			</tr>
			
			<tr>
				<th style="width: 100px;">家庭地址</th>
				<td><input name="adress" style="width: 145px;"/>
				</td>
				<th style="width: 100px;">家庭电话</th>
				<td><input name="tel" style="width: 145px;" />
				</td>
			</tr>
		</table>
	</form>
</div>